﻿@{ Layout = "../../Views/Shared/_LayoutPhone.cshtml";}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
</head>
<body>
    <div id="shu"></div>
    <div class="card mb-4">
        <div class="card-header border-bottom">
            <div class="media">
                <div class="icon-circle icon-40 bg-light-primary mr-3">
                    <i class="material-icons">business</i>
                </div>
                <div class="media-body">
                    <h6 id="h6bind" class="my-0 content-color-primary">今日跟进记录</h6>
                    <p id="pqiehuan" class="small mb-0">切换至三日</p>
                </div>
            </div>
        </div>
        <div class="card-body">
            <ul id="ulbind" class="list-group list-group-flush w-100 log-information mt-2">
            </ul>
        </div>
    </div>
    <div style="margin-bottom: 50px;padding-bottom:1px"></div>
    <script>
        $(document).ready(function () {
            if (getQuery("Day") == "3") {
                BindTodayGenJinJiLu3Day();
                $("#pqiehuan").html("切换至今日");
                $("#h6bind").html("近三日跟进记录");
            } else {
                BindTodayGenJinJiLu();
            }
            $("#pqiehuan").click(function () {
                if ($("#pqiehuan").html() == "切换至三日") {
                    $("#pqiehuan").html("切换至今日");
                    $("#h6bind").html("近三日跟进记录");
                    BindTodayGenJinJiLu3Day();
                } else {
                    $("#pqiehuan").html("切换至三日");
                    $("#h6bind").html("今日跟进记录");
                    BindTodayGenJinJiLu();
                }
            });
        });
        function BindTodayGenJinJiLu() {
            $.ajax({
                type: "POST",
                url: "../PhoneKeHu/BindTodayGenJinJiLu",
                cache: false,  //禁用缓存
                data: { "Day": 1 },
                dataType: "Json",
                success: function (response) {
                    $("#ulbind").html("");
                    $(response).each(function (key) {
                        $("#ulbind").append("<li class=\"list-group-item\"><div class=\"avatar avatar-15 border-success\"></div><div class=\"media experience\"><div class=\"media-body\"><h6 class=\"my-0 content-color-primary\">" + response[key].t_XiaoShouBiao.t_KeHuBiao.KeHuXingMing + "</h6><p class=\"mb-2\"><small class=\"content-color-secondary\">" + response[key].CaoZuoShiJian + "</small></p><p>" + response[key].MiaoShu + "</p></div></div></li>");
                    })
                }
            });
        }
        function BindTodayGenJinJiLu3Day() {
            $.ajax({
                type: "POST",
                url: "../PhoneKeHu/BindTodayGenJinJiLu",
                cache: false,  //禁用缓存
                data: { "Day": 3 },
                dataType: "Json",
                success: function (response) {
                    $("#ulbind").html("");
                    $(response).each(function (key) {
                        $("#ulbind").append("<li class=\"list-group-item\"><div class=\"avatar avatar-15 border-success\"></div><div class=\"media experience\"><div class=\"media-body\"><h6 class=\"my-0 content-color-primary\">" + response[key].t_XiaoShouBiao.t_KeHuBiao.KeHuXingMing + "</h6><p class=\"mb-2\"><small class=\"content-color-secondary\">" + response[key].CaoZuoShiJian + "</small></p><p>" + response[key].MiaoShu + "</p></div></div></li>");
                    })
                }
            });
        }
        function getQuery(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURI(r[2]); return null;
        }
    </script>
</body>
</html>
